﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DinhMuc.Public;

namespace DinhMuc.DAL
{
   public class tblTKSX_TPDAL
    {
        clsConnect cn = new clsConnect();
        public DataTable bangTKSX_TP()
        {
            return cn.LoadTableStore("sp_TKSX_TP_select");
        }
        public DataTable bangTKSX_TP(int ID_SX_TP)
        {
            int para = 1;
            string[] name = new string[para];
            object[] value = new object[para];
            name[0] = "@ID_SX";
            value[0] = ID_SX_TP;
            return cn.LoadTable_loc("sp_TKSX_TP_byID_SX_select", name, value, para);
        }
        public int themTKSX(tblTKSX_TPPublic p)
        {
            int para = 10;
            string[] name = new string[para];
            object[] value = new object[para];
            name[0] = "@ID_DM";
            name[1] = "@thoiTT";
            name[2] = "@trangL1TT";
            name[3] = "@trangL2TT";
            name[4] = "@inTT";
            name[5] = "@chiaCuonTT";
            name[6] = "@catDanTT";
            name[7] = "@ngay";
            name[8] = "@ca";
            name[9] = "@phuTrach";
            value[0] = p.Id_DM;
            value[1] = p.ThoiTT;
            value[2] = p.TrangL1TT;
            value[3] = p.TrangL2TT;
            value[4] = p.InTT;
            value[5] = p.ChiaCuonTT;
            value[6] = p.CatDanTT;
            value[7] = p.Ngay;
            value[8] = p.Ca;
            value[9] = p.PhuTrach;
            return cn.UpdateTableStore("sp_TKSX_TP_insert", name, value, para);
        }
        public int suaTKSX(tblTKSX_TPPublic p)
        {
            int para = 10;
            string[] name = new string[para];
            object[] value = new object[para];
            name[0] = "@ID_SX";
            name[1] = "@thoiTT";
            name[2] = "@trangL1TT";
            name[3] = "@trangL2TT";
            name[4] = "@inTT";
            name[5] = "@chiaCuonTT";
            name[6] = "@catDanTT";
            name[7] = "@ngay";
            name[8] = "@ca";
            name[9] = "@phuTrach";
            value[0] = p.Id_SX;
            value[1] = p.ThoiTT;
            value[2] = p.TrangL1TT;
            value[3] = p.TrangL2TT;
            value[4] = p.InTT;
            value[5] = p.ChiaCuonTT;
            value[6] = p.CatDanTT;
            value[7] = p.Ngay;
            value[8] = p.Ca;
            value[9] = p.PhuTrach;
            return cn.UpdateTableStore("", name, value, para);
        }
        public int xoaTKSX(int ID)
        {
            int para = 1;
            string[] name = new string[para];
            object[] value = new object[para];
            name[0] = "@ID_SX";
            value[0] = ID;
            return cn.UpdateTableStore("sp_TKSX_TP_delete", name, value, para);
        }
        
    }
}
